import Fluent

struct CreateAdvancedBuilding: Migration {
    
    func prepare(on database: Database) -> EventLoopFuture<Void> {
        database.schema("advancedbuilding")
            .id()
            .field("ownersEMailAddress", .string, .required)
            .field("demo", .bool, .required)
            .field("tag", .string)
            .field("customLogoID", .string)
            .field("positionX", .double, .required)
            .field("positionY", .double, .required)
            .field("name", .string, .required)
            .field("width", .double, .required)
            .field("length", .double, .required)
            .field("height", .double, .required)
            .field("pitch", .double, .required)
            .field("wallTickness", .double, .required)
            .field("floorOverlappingBuildingSize", .double, .required)
            .field("floorTickness", .double, .required)
            .field("roofTickness", .double, .required)
            .field("roofOverhangSide", .double, .required)
            .field("roofOverhangFrontRear", .double, .required)
            .field("highPressureCooling", .bool, .required)
            .field("distanceWallHeaters", .double, .required)
            .field("sideModeExhaustSystemEnumInt", .int16, .required)
            .field("ventilationSystemEnumInt", .int16, .required)
            .field("sideDogHouseLength", .double, .required)
            .field("numberOfHeaters", .int16, .required)
            .field("numberOfInlets", .int16, .required)
            .field("dogHouseSide", .bool, .required)
            .field("dogHouseFront", .bool, .required)
            .field("numberOfFansSide", .int16, .required)
            .field("numberOfFansEnd", .int16, .required)
            .field("numberOfChimneys", .int16, .required)
            .field("numberOfRowsOfInlets", .int16, .required)
            .field("tunnelAirspeed", .double, .required)
            .field("animalTypeEnumInt", .int16, .required)
            .field("animalWeight", .double, .required)
            .field("numberAnimals", .int64, .required)
            .field("numberOfFeedingBins", .int16, .required)
            .field("controlPanelSupplier", .int16, .required)
            .field("serviceRoom", .bool, .required)
            .field("serviceRoomHeight", .double, .required)
            .field("serviceRoomWidth", .double, .required)
            .field("serviceRoomLength", .double, .required)
            .field("serviceRoomDoorHeight", .double, .required)
            .field("cages_cages", .bool, .required)
            .field("cages_name", .string, .required)
            .field("cages_sectionLength", .double, .required)
            .field("cages_sectionWidth", .double, .required)
            .field("cages_sectionHeight", .double, .required)
            .field("cages_startLength", .double, .required)
            .field("cages_endLength", .double, .required)
            .field("cages_bottomHeight", .double, .required)
            .field("cages_extensionDueToCatwalkPartHeight", .double, .required)
            .field("cages_catWalkHeigth", .double, .required)
            .field("cages_startPositionCagesIntoTheWidth", .double, .required)
            .field("cages_startPositionCagesIntoTheLength", .double, .required)
            .field("cages_NumberOfSections", .int16, .required)
            .field("cages_NumberOfTiersRow01", .int16, .required)
            .field("cages_NumberOfTiersRow02", .int16, .required)
            .field("cages_NumberOfTiersRow03", .int16, .required)
            .field("cages_NumberOfTiersRow04", .int16, .required)
            .field("cages_NumberOfTiersRow05", .int16, .required)
            .field("cages_NumberOfTiersRow06", .int16, .required)
            .field("cages_NumberOfTiersRow07", .int16, .required)
            .field("cages_NumberOfTiersRow08", .int16, .required)
            .field("cages_NumberOfTiersRow09", .int16, .required)
            .field("cages_NumberOfTiersRow10", .int16, .required)
            .field("cages_NumberOfTiersRow11", .int16, .required)
            .field("cages_NumberOfTiersRow12", .int16, .required)
            .field("cages_catwalk1AboveTier", .int16, .required)
            .field("cages_catwalk2AboveTier", .int16, .required)
            .create()
    }
    
    func revert(on database: Database) -> EventLoopFuture<Void> {
        database.schema("advancedbuilding").delete()
    }
}
